/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.Entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Vi
 */
@Entity
@Table(name = "employee")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Employee.findAll", query = "SELECT e FROM Employee e"),
    @NamedQuery(name = "Employee.findByIdEmployee", query = "SELECT e FROM Employee e WHERE e.idEmployee = :idEmployee"),
    @NamedQuery(name = "Employee.findByName", query = "SELECT e FROM Employee e WHERE e.name = :name"),
    @NamedQuery(name = "Employee.findBySurname", query = "SELECT e FROM Employee e WHERE e.surname = :surname"),
    @NamedQuery(name = "Employee.findByPosition", query = "SELECT e FROM Employee e WHERE e.position = :position"),
    @NamedQuery(name = "Employee.findByEducation", query = "SELECT e FROM Employee e WHERE e.education = :education"),
    @NamedQuery(name = "Employee.findByCertifications", query = "SELECT e FROM Employee e WHERE e.certifications = :certifications"),
    @NamedQuery(name = "Employee.findByEmployment", query = "SELECT e FROM Employee e WHERE e.employment = :employment"),
    @NamedQuery(name = "Employee.findByDateEmployment", query = "SELECT e FROM Employee e WHERE e.dateEmployment = :dateEmployment"),
    @NamedQuery(name = "Employee.findByWorkIt", query = "SELECT e FROM Employee e WHERE e.workIt = :workIt"),
    @NamedQuery(name = "Employee.findByOtherProjects", query = "SELECT e FROM Employee e WHERE e.otherProjects = :otherProjects"),
    @NamedQuery(name = "Employee.findByTimeOtherProjects", query = "SELECT e FROM Employee e WHERE e.timeOtherProjects = :timeOtherProjects")})
public class Employee implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_employee")
    private Integer idEmployee;
    @Size(max = 100)
    @Column(name = "name")
    private String name;
    @Size(max = 100)
    @Column(name = "surname")
    private String surname;
    @Size(max = 2)
    @Column(name = "position")
    private String position;
    @Size(max = 2)
    @Column(name = "education")
    private String education;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "certifications")
    private Double certifications;
    @Column(name = "employment")
    private Double employment;
    @Column(name = "date_employment")
    @Temporal(TemporalType.DATE)
    private Date dateEmployment;
    @Column(name = "work_it")
    private Double workIt;
    @Column(name = "other_projects")
    private Integer otherProjects;
    @Column(name = "time_other_projects")
    private Double timeOtherProjects;
    @OneToMany(mappedBy = "idEmployee")
    private Collection<EmployeeTests> employeeTestsCollection;
    @OneToMany(mappedBy = "idEmployee")
    private Collection<EmployeeLanguages> employeeLanguagesCollection;
    @OneToMany(mappedBy = "idEmployee")
    private Collection<EmployeeProjects> employeeProjectsCollection;

    public Employee() {
    }

    public Employee(String name, String surname, String position, String education, Double certifications, Double employment, Date dateEmployment, Double workIt, Integer otherProjects, Double timeOtherProjects) {
        this.name = name;
        this.surname = surname;
        this.position = position;
        this.education = education;
        this.certifications = certifications;
        this.employment = employment;
        this.dateEmployment = dateEmployment;
        this.workIt = workIt;
        this.otherProjects = otherProjects;
        this.timeOtherProjects = timeOtherProjects;
    }

  

    public Employee(Integer idEmployee) {
        this.idEmployee = idEmployee;
    }

    public Integer getIdEmployee() {
        return idEmployee;
    }

    public void setIdEmployee(Integer idEmployee) {
        this.idEmployee = idEmployee;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public String getEducation() {
        return education;
    }

    public void setEducation(String education) {
        this.education = education;
    }

    public Double getCertifications() {
        return certifications;
    }

    public void setCertifications(Double certifications) {
        this.certifications = certifications;
    }

    public Double getEmployment() {
        return employment;
    }

    public void setEmployment(Double employment) {
        this.employment = employment;
    }

    public Date getDateEmployment() {
        return dateEmployment;
    }

    public void setDateEmployment(Date dateEmployment) {
        this.dateEmployment = dateEmployment;
    }

    public Double getWorkIt() {
        return workIt;
    }

    public void setWorkIt(Double workIt) {
        this.workIt = workIt;
    }

    public Integer getOtherProjects() {
        return otherProjects;
    }

    public void setOtherProjects(Integer otherProjects) {
        this.otherProjects = otherProjects;
    }

    public Double getTimeOtherProjects() {
        return timeOtherProjects;
    }

    public void setTimeOtherProjects(Double timeOtherProjects) {
        this.timeOtherProjects = timeOtherProjects;
    }

    @XmlTransient
    public Collection<EmployeeTests> getEmployeeTestsCollection() {
        return employeeTestsCollection;
    }

    public void setEmployeeTestsCollection(Collection<EmployeeTests> employeeTestsCollection) {
        this.employeeTestsCollection = employeeTestsCollection;
    }

    @XmlTransient
    public Collection<EmployeeLanguages> getEmployeeLanguagesCollection() {
        return employeeLanguagesCollection;
    }

    public void setEmployeeLanguagesCollection(Collection<EmployeeLanguages> employeeLanguagesCollection) {
        this.employeeLanguagesCollection = employeeLanguagesCollection;
    }

    @XmlTransient
    public Collection<EmployeeProjects> getEmployeeProjectsCollection() {
        return employeeProjectsCollection;
    }

    public void setEmployeeProjectsCollection(Collection<EmployeeProjects> employeeProjectsCollection) {
        this.employeeProjectsCollection = employeeProjectsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEmployee != null ? idEmployee.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Employee)) {
            return false;
        }
        Employee other = (Employee) object;
        if ((this.idEmployee == null && other.idEmployee != null) || (this.idEmployee != null && !this.idEmployee.equals(other.idEmployee))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.Entity.Employee[ Employee= imie: " + name +" nazwisko :"+ surname + " pozycja: " + position + " edukacja: " + education + " certyfikaty: " +certifications + " zatrudnienie: " +employment + " data zarudnienia: " +
               dateEmployment+" praca w it: " + workIt + " inne projekty: " +otherProjects + " czas w innych: " + timeOtherProjects +" ]";
    }
    
}
